package com.my.study.dev;

import org.junit.Test;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author: yidujun
 * @create: 2022/04/12 16:46
 */
public class PatternTest {

    @Test
    public void test01() {
        String regex = "o{2}";
        String charSequence = "food, book";
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(charSequence);

        System.out.println(matcher.matches());

        while (matcher.find()) {
            System.out.println(matcher.group());
        }
    }



}
